package java学习.实训.day04;

/**
 * **************
 * 项目名称: 蓝桥杯 <br/>
 * 文件名称:  <br/>
 * 文件描述: 这里添加您的类文件描述，说明当前文件要包含的功能。 <br/>
 * 文件创建：刘世锦 <br/>
 * 创建时间: 2022/6/10 <br/>
 *
 * @version v1.0 <br/>
 * @update [序号][日期YYYY-MM-DD][更改人姓名][变更描述]<br/>
 * *************
 */
public class Test {
    int i = 'A';
    public static void main(String[] args) {
        Gun gun = new Gun("AK-47", 100, 1600);
        gun.fireBullet();
        new Dagger("银匕首",1000,16000).toAttack();
        System.out.println(Math.round(11.5));
        System.out.println(Math.round(-11.5));
        for (int i = 0; i < 5; i++) {
            System.out.print(i+1);
            System.out.println(i);
        }
        String s = "asfd";
    }
}

class Weapon{
    private String name;
    private int AttackPower;
    private double price;

    public Weapon(String name, int attackPower, double price) {
        this.name = name;
        AttackPower = attackPower;
        this.price = price;
    }

    @Override
    public String toString() {
        return "Weapon{" +
                "name='" + name + '\'' +
                ", AttackPower=" + AttackPower +
                ", price=" + price +
                '}';
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public int getAttackPower() {
        return AttackPower;
    }

    public void setAttackPower(int attackPower) {
        AttackPower = attackPower;
    }

    public double getPrice() {
        return price;
    }

    public void setPrice(double price) {
        this.price = price;
    }
}

class Gun extends Weapon{

    public Gun(String name, int attackPower, double price) {
        super(name, attackPower, price);
    }

    public void fireBullet(){
        System.out.println(this.getName()+"发射子弹,攻击力为"+this.getAttackPower()+"价格为："+this.getPrice());
    }
    @Override
    public String toString() {
        return super.toString();
    }
}

class  Dagger extends Weapon{

    public Dagger(String name, int attackPower, double price) {
        super(name, attackPower, price);
    }
    public void toAttack(){
        System.out.println(this.getName()+"攻击力为"+this.getAttackPower()+"价格为："+this.getPrice());
    }
    @Override
    public String toString() {
        return super.toString();
    }
}